"use strict";
// function getMaxValue(array:Array<number>):number{
//     let max = array[0]
//     array.forEach(item=>max=item>max?item:max)
//     return max
// }
// let arr:number[] = [1,2,3,4]
// const res = getMaxValue(arr)
/**
 * new Date()
 * 编写一个函数,传递一个日期对象,返回一个 2023-12-34 12:00:00
 */
// function format(date:Date):string{
//     const year = date.getFullYear()
//     const month = date.getMonth() + 1
//     const day = date.getDate()
//     return year + "-" + month + "-" + day
// }
function format(date, type) {
    type = type.replace("yyyy", date.getFullYear() + "");
    type = type.replace("MM", (date.getMonth() + 1) + "");
    type = type.replace("dd", date.getDate() + "");
    type = type.replace("hh", date.getHours() + "");
    //
    return type;
}
const res3 = format(new Date(), "yyyy-MM-dd"); //2023-09-22
console.log(res3);
const res4 = format(new Date(), "yyyy/MM/dd hh:mm:ss"); //2023/09/22 16:54:20
console.log(res4);
